<template>
  <div>
    <!-- <h1>首页</h1> -->
    <router-view></router-view>
<footer class="footer2">
    <router-link v-for="item in navs" :key="item.path" :to="item.path" active-class="select">
        <img :src="$route.path===item.path?item.select_img:item.no_select" alt="">
        <div>{{item.name}}</div>
    </router-link>
</footer>
  </div>
</template>

<script>
import home_y from "../../assets/img/home_y.jpeg";
import home_n from "../../assets/img/home_n.jpeg";
import cate_y from "../../assets/img/cate_y.jpeg";
import cate_n from "../../assets/img/cate_n.jpeg";
import shop_y from "../../assets/img/shop_y.jpeg";
import shop_n from "../../assets/img/shop_n.jpeg";
import mine_y from "../../assets/img/mine_y.jpeg";
import mine_n from "../../assets/img/mine_n.jpeg";
export default {
  data() {
    return {
      navs: [
        {
          path: "/index/home",
          name: "首页",
          select_img: home_y,
          no_select: home_n,
        },
                {
          path: "/index/cate",
          name: "分类",
          select_img: cate_y,
          no_select: cate_n,
        },
                {
          path: "/index/shop",
          name: "购物车",
          select_img: shop_y,
          no_select: shop_n,
        },
                {
          path: "/index/mine",
          name: "个人中心",
          select_img: mine_y,
          no_select: mine_n,
        },
      ],
    };
  },
};
</script>

<style scoped>
div {
  padding-bottom: 1rem;
}

.footer2{
  height: 1rem;
  position: fixed;
  width: 100vw;
  background: #fff;
  left: 0;
  bottom: 0;
  border-top: 0.01rem solid #ccc;
  display: flex;
}
.footer2 a{
  flex: 1;
  text-align: center;
}
.footer2 a img{
  width: 0.5rem;
  height: 0.5rem;
}
.footer2 a div{
  font-size: 0.24rem;
  line-height: 0.5rem;
  color:#333;
}
.footer2 .select div{
  color: #ff4400;
}

</style>